// pages/shop_comment/index.js
var t = getApp(),
  a = t.requirejs("core");
Page({

  /**
   * 页面的初始数据
   */
  data: {
  page:1,
  list:[],
  loaded:false,
  show:true
  },
  //底部导航跳转
  menu_url: function (k) {
    a.menu_url(k, 2);
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.comment()
  
  },
  comment: function () {
    var that=this;
    a.get("Catering/CommentList", { page: that.data.page }, function (i) {
      if (i.code == 0) {
        var a = { sroce: i.info.sroce, count: i.info.count,show:true };
        if (i.info.info.length<10){a.loaded=true}
        if (i.info.info.length >0){
          a.page=that.data.page+1;
          a.list=that.data.list.concat(i.info.info);
        }
        a.list = i.info.info;
        that.setData(a)
      } else {
        e.alert(i.msg)
      }
    },true)
  },



  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  this.setData({
    list:[],
    page:1,
    loaded:false,
  })
  this.comment();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.data.loaded || this.comment();
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})